/*
 * main.c
 *
 *  Created on: Jan 23, 2025
 *      Author: hudong
 */
#include "../include/cjson.h"
#include "../include/except.h"
#include <linux/limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
  cjson.init();

  FILE *stream = fopen("get.json", "r");
  Try.checkAlloc(stream, "Failed to open the file.");

  JSON *json = cjson.parse(stream);

  JSON *data = cjson.getJSONByKey(json, "data");
  JSON *klines = cjson.getJSONByKey(data, "klines");

  cjson.stringify(json, stderr);

  fclose(stream);

  fprintf(stderr, "Finished !\n");

  cjson.free(json);

  cjson.destroy();
}
